package com.glsc.ngateway.oaflow.controller;

import com.glsc.ngateway.common.base.repo.mysql.gateway.oaflow.TFixedincomeProcessRepository;
import com.glsc.ngateway.oaflow.schedule.FixedIncomeTask;
import com.glsc.ngateway.oaflow.service.FixedIncomeService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class FixedIncomeController {

    private Logger logger = LoggerFactory.getLogger(this.getClass());

    @Autowired
    FixedIncomeTask s;
    @Autowired
    FixedIncomeService fixedIncomeService;

    @Autowired
    TFixedincomeProcessRepository r;

    @RequestMapping(method = RequestMethod.POST, value = "doTask")
    public void doTask(@RequestParam String nodeId, @RequestParam String action, @RequestParam String key) {
        fixedIncomeService.doTask(nodeId, action, key, null, "");
    }

    @RequestMapping(method = RequestMethod.GET, value = "search")
    public void search() {
//        fixedIncomeService.searchTaskToDeal();

//        s.syncOaToFix();
        s.getBusinessTrip();
//        fixedIncomeService.getKeyFromLogin();
    }

    @RequestMapping(method = RequestMethod.POST, value = "endOaFlow")
    public void endOaFlow(@RequestParam String requestid) {
        fixedIncomeService.endOaFlow(requestid);
    }


}
